<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script src="./Promise.js?a=1"></script>
    <script>
        // 1- catch
        const p1 = new Promise((resolve,reject)=>{
            reject(100);
        })
        // p1.then(value=>{
        //     console.log("成功回调",value);
        // },reason=>{
        //     console.log("失败回调",reason)
        // })

        // p1的状态为失败时,会执行catch指定的回调
        const p2 = p1.catch(reason=>{
            console.log(reason);
            return 100;
        })
        console.log(p2);
        // 相当于
        // p1.then(undefined,reason=>{
        //     console.log(reason);
        // })
    </script>
</body>
</html>